import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号

# 数据：x=难度，y=区分度，标记错误题目
x = [0.35, 0.28, 0.22] + [0.6, 0.7, 0.8]
y = [0.42, 0.38, 0.45] + [0.25, 0.3, 0.2]
is_wrong = [True, True, True] + [False]*3

plt.figure(figsize=(8, 5))
wrong_plotted = False
correct_plotted = False

for xi, yi, wrong in zip(x, y, is_wrong):
    if wrong:
        if not wrong_plotted:
            plt.scatter(xi, yi, marker='^', color='red', s=100, label='错误题目')
            wrong_plotted = True
        else:
            plt.scatter(xi, yi, marker='^', color='red', s=100)
    else:
        if not correct_plotted:
            plt.scatter(xi, yi, marker='o', color='blue', s=50, label='正确题目')
            correct_plotted = True
        else:
            plt.scatter(xi, yi, marker='o', color='blue', s=50)

plt.xlabel("题目难度（P值）")
plt.ylabel("区分度（D值）")
plt.title("瑞文测验题目难度-区分度分布")
plt.legend()
plt.grid(True)
plt.show()